<#include "/common/_header.html" />
<div class="page-group"><!-- 页面组 -->
	<div class="page page-current"><!-- 页面组中的每一个页面，可以互相跳转 -->
		<header class="bar bar-nav"><!-- 每个页面的头部 -->
			<button class="button button-link button-nav pull-left" onclick="javascript:location.href = '${path}/checkin'">
				<span class="icon icon-left"></span> 返回
			</button>
			<h1 class="title" style="font-size: 1rem;">我的资料</h1>
		</header>
		<div class="content native-scroll"><!-- 每个页面的内容区域 -->
			<form id="editform" action="${path}/checkin/editEntity" method="post">
			<input type="hidden" name="user.id" value="${user.id}">
			<input type="hidden" name="user.homeTownTimes" value="${user.homeTownTimes}">
			<input type="hidden" name="oldHomeTown" value="${user.homeTown}">
			<div class="list-block">
			    <ul>
			      <li>
			        <div class="item-content">
			          <div class="item-media"><i class="icon icon-form-name"></i></div>
			          <div class="item-inner">
			            <div class="item-title label">昵称</div>
			            <div class="item-input">
			              <input type="text" placeholder="您的昵称" name="user.nickname" value="${user.nickname}">
			            </div>
			          </div>
			        </div>
			      </li>
			      <li>
			        <div class="item-content">
			          <div class="item-media"><i class="icon icon-form-password"></i></div>
			          <div class="item-inner">
			            <div class="item-title label">
			            	<span>家乡</span>
			            	<span style="color:#ff9900;font-size:0.5rem;">剩余修改次数：${user.homeTownTimes}</span>
			            </div>
			            <div class="item-input">
			              <input placeholder="您的家乡" name="user.homeTown" value="${user.homeTown}" id="city-picker"
			              ${(user.homeTownTimes=0)?string('disabled','')}>
			            </div>
			          </div>
			        </div>
			      </li>
			      <li>
			        <div class="item-content">
			          <div class="item-media"><i class="icon icon-form-gender"></i></div>
			          <div class="item-inner">
			            <div class="item-title label">性别</div>
			            <div class="item-input" style="display: inline-flex;">
			              <select name="user.sex">
			                <option value="1" ${(user.sex=1)?string('selected','')}>男</option>
			                <option value="2" ${(user.sex=2)?string('selected','')}>女</option>
			                <option value="0" ${(user.sex=0)?string('selected','')}>保密</option>
			              </select>
			              <span class="pull-right iconfont icon-unfold" style="color:#ccc"></span>
			            </div>
			          </div>
			        </div>
			      </li>
			    </ul>
			  </div>
			  <div class="content-block">
			    <div class="row">
			      <div class="col-50"><a onclick="javascript:location.href = '${path}/checkin'" href="#" class="button button-big button-fill button-danger">取消</a></div>
			      <div class="col-50"><a onclick="submitForm()" href="#" class="button button-big button-fill button-success">提交</a></div>
			    </div>
			  </div>
		   </form>		
		</div>
	</div>
</div>
<#include "/common/_footer.html" />
<script type="text/javascript" src="//g.alicdn.com/msui/sm/0.6.2/js/sm-city-picker.min.js" charset="utf-8"></script>
<script>
<#if (user.homeTownTimes > 0)>
	$("#city-picker").cityPicker({
	    toolbarTemplate: '<header class="bar bar-nav">'+
	    '<button class="button button-link pull-right close-picker">确定</button>'+
	    '<h1 class="title">请选择您的家乡</h1></header>'
	});
</#if>
function submitForm(){
	if($("input[name='user.nickname']").val().trim()==''){
		$toast("请填写您的昵称");
		return false;
	}else if($("input[name='user.homeTown']").val().trim()==''){
		$toast("请选择您的家乡");
		return false;
	}
	$("#editform").submit();
}
</script>